<?php
/* --------------------------------------------------------------
   gm_convert_qty.inc.php 2008-12-19 gambio
   Gambio OHG
   http://www.gambio.de
   Copyright (c) 2008 Gambio OHG
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
   --------------------------------------------------------------
*/
?><?php
	
function gm_convert_qty($number, $intern = true){
	if($intern) $number = str_replace(',', '.', $number);
	$number = (double)$number;
	
	if(!$intern){
		$get_decimal = xtc_db_query("SELECT decimal_point 
																	FROM currencies 
																	WHERE code = '" . $_SESSION['currency'] . "' 
																	LIMIT 1");
		if(xtc_db_num_rows($get_decimal) == 1){
			$row = xtc_db_fetch_array($get_decimal);
			$number = str_replace('.', $row['decimal_point'], $number);
		}
		else $number = str_replace('.', ',', $number);
	}
	
	return $number;
}
?>